<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<#include "/apps/service/include/left.html">
	</div>
</div>
<div class="layui-body">
	<div class="layui-side-scroll">
		<div class="row">
			<div class="col-lg-12">
				<h1 class="site-h1" style="border-top:1px solid #e6e6e6;">
					短信发送历史
					<div class="layui-btn-group ukefu-btn-group" style="float: right;">
						<button class="layui-btn layui-btn-sm dropdown-menu">
							<i class="kfont">&#xe672;</i> 导出 
							<i class="layui-icon">&#xe625;</i>
						</button>
						<ul class="ukefu-dropdown-menu layui-anim layui-anim-upbit">
							<li>
								<a href="javascript:void(0)" id="batexp" title="导出选中结果" target="_blank">
									<i class="kfont">&#xe672;</i>
									导出选中结果
								</a>
							</li>
							<li>
								<a href="/service/sms/expsearch.html?1=1<#if name??>&name=${name!''}</#if><#if phonenumber??>&phonenumber=${phonenumber}</#if><#if begin??>&begin=${begin}</#if><#if end??>&end=${end}</#if><#if sysDic>&tptype=${sysDic.id!''}</#if>" title="导出短信发送历史" target="_blank">
									<i class="kfont">&#xe672;</i>
									导出当前搜索结果
								</a>
							</li>
							<li>
								<a href="/service/sms/expall.html" title="导出对话记录" target="_blank">
									<i class="kfont">&#xe672;</i>
									导出全部数据
								</a>
							</li>
						</ul>
					</div>
				</h1>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12">
				<form class="layui-form" name="search"	action="/service/sms/index.html" method="get" style="float: left;margin-right:5px;"  autocomplete="off">
					<div class="ukefu-bt-text-content">
						<table class="layui-table" lay-skin="nob">
							<tbody>
								<tr class="tdHasContorllor design-dropable-td">
									<td width="1%" nowrap="nowrap">用户名：</td>
									<td width="20%">
										<input type="text" name="name" placeholder="坐席" autocomplete="off" value="${name!''}" class="layui-input">
									</td>
									
									<td width="1%" nowrap="nowrap">号码：</td>
									<td width="20%">
										<input type="text" name="phonenumber" placeholder="请输入号码" autocomplete="off" value="${phonenumber!''}" class="layui-input">
									</td>
									<td width="1%" nowrap="nowrap">发送时间：</td>
									<td width="20%">
										<input name="begin" class="layui-input" value="${begin!''}" readOnly="readOnly" placeholder="开始日期" value=""  data-datetype="laydate">
									</td>
									
									<td width="1%" nowrap="nowrap" style="text-align: center;">～</td>
									<td width="20%">
										<input name="end" class="layui-input " value="${end!''}" readOnly="readOnly" placeholder="结束日期" value="" data-datetype="laydate">
									</td>
								</tr>
								
								<tr class="tdHasContorllor design-dropable-td">
									
									<td width="1%" nowrap="nowrap">
										<button class="layui-btn layui-btn-sm" type="submit">
											<i class="layui-icon"></i> 
											查询
										</button>
									</td>
									
								</tr>
							</tbody>
						</table>
					</div>
				</form>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12">
				<h1 class="site-h1" style="border-top:1px solid #e6e6e6;">
					短信发送历史<#if smsResultList??>（${smsResultList.totalElements}）</#if>
					<span style="float:right;">
						
					</span>
				</h1>
				<table class="layui-table" lay-skin="line">
					<thead>
						<tr class="design-sortable-tr">
							<th>
								<input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
							</th>
							<th>用户名</th>
							<th>号码</th>
							<th>网关类型</th>
							<th>坐席</th>
							<th>提交时间</th>
							<th>内容</th>
							<th>发送状态</th>
						</tr>
					</thead>
					<tbody>
						<#if smsResultList?? && smsResultList.content?? && smsResultList.content?size gt 0>
						<#list smsResultList.content as smsResult>
						<tr class="tdHasContorllor design-dropable-td">
							<td style="width:1%;">
								<input type="checkbox" class="ids" name="ids" value="${smsResult.id!''}"/>
							</td>
							<td class=" first_td_head">
								${smsResult.name!''}
							</td>
							<td>
								${smsResult.phonenumber!''}
							</td>
							<td>
								${smsResult.smstype!''}
							</td>
							<td>
								${smsResult.extno!''}
							</td>
							<td><#if smsResult.subtime??>${smsResult.subtime?string('yyyy-MM-dd HH:mm:ss')}</#if></td>
							<td>
								${smsResult.smstext!''}
							</td>
							<td title="${smsResult.sendresult!''}">
								<#if smsResult.sendok?? && smsResult.sendok == true>
								<i class="layui-icon" style="color:#32c24d;">&#xe605;</i>
								<#else>
								<i class="layui-icon" style="color:red;">&#x1006;</i>
								</#if>
							</td>
						</tr>
						</#list>
						<#else>
							<tr>
								<td colspan="20" style="height:400px;">
									<div class="ukefu-empty">
										<i class="layui-icon">&#xe63a;</i>
										<div style="">还没有历史会话</div>
									</div>
								</td>
							</tr>
						</#if>
					</tbody>
				</table>

			</div>
		</div>
		<div class="row" style="padding:5px;">
			<div class="col-lg-12" id="page" style="text-align:center;"></div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		$('#batexp').click(function(){
			var ids = "";
			var num = 0 ;
			$('.ids').each(function(){
				if($(this).prop("checked")){
					if(ids!=""){
						ids += "&" ;
					}
					ids += "ids=" + $(this).val();
					num++;
				}
			});
			if(num>0){
				$('#batexp').attr('href' , '/service/sms/expids.html?'+ids)	;
			}else{
				top.layer.alert("请先选择需要导出的通话记录");
				$('#batexp').attr("href" , "javascript:void(0)");
			}
			
			
		});
		
	});
	layui.use('form', function(){
	  var form = layui.form;
	  form.render(); //更新全部
	});
	layui.use('laydate', function() {
		var laydate = layui.laydate;
	});
	layui.use(['laypage', 'layer'], function(){
		  var laypage = layui.laypage
		  ,layer = layui.layer;
		  
		  laypage.render({
				elem: 'page'
				,pages: <#if smsResultList??>${smsResultList.totalPages}<#else>0</#if> //总页数
				,curr:<#if smsResultList??>${smsResultList.number+1}<#else>0</#if>
				,groups: 5 //连续显示分页数
				,jump:function(data , first){
					if(!first){
						location.href = "/service/sms/index.html?1=1<#if name??>&name=${name!''}</#if><#if phonenumber??>&phonenumber=${phonenumber}</#if><#if begin??>&begin=${begin}</#if><#if end??>&end=${end}</#if><#if sysDic>&tptype=${sysDic.id!''}</#if>p="+data.curr ;
					}
				}
		   });
		});

</script>
